#!/bin/bash

export PATH=.:./tools:../tools:/usr/sbin:/usr/bin:/sbin:/bin:/

if [ -f /linux-live/container_config ]; then
	. /linux-live/container_config || exit 1
else
	. /linux-live/config || exit 1
fi
. /minioslib || exit 1
. /minios-build.conf || exit 1

console_colors

# build initramfs image
echo -e "=====> ${CYAN}Building intramfs image ...${ENDCOLOR}"
echo -e "=====  ${YELLOW}KERNEL=${KERNEL}${ENDCOLOR}"
echo -e "=====  ${YELLOW}KERNEL_BPO=${KERNEL_BPO}${ENDCOLOR}"
echo -e "=====  ${YELLOW}KERNEL_AUFS=${KERNEL_AUFS}${ENDCOLOR}"

cd /linux-live/initramfs/livekit-mos
chmod 755 ./mkinitrfs
INITRAMFS=$(./mkinitrfs "${KERNEL}")
if [ -n "${INITRAMFS}" ]; then
	mv "${INITRAMFS}" /boot/initrfs.img
fi
